import { h } from "snabbdom";
import { handleDeleteNode, handleSSMLRemarkClick } from "../helper";
export default {
    type: "ssml-break",
    renderElem: function (elem, _children, editor) {
        // 将elem转换为Break类型，这里假设elem已经包含了Break类型所需的属性
        const ssml_elem = elem;
        return h(
            "span",
            {
                className: "ssml-wrapper",
                contentEditable: false,
            },
            [
                h(
                    "span",
                    {
                        className: "remarkWrapper",
                        style: { backgroundColor: "#27ae60", padding: "0 5px" },
                        on: {
                            mousedown: function (event) {
                                event.preventDefault();
                            },
                            click: function () {
                                console.log("handleSSMLRemarkClick");
                                handleSSMLRemarkClick(editor, ssml_elem);
                            },
                        },
                    },
                    [
                        h(
                            "span",
                            {
                                className: "data-content",
                                "data-content": ssml_elem.remark,
                            }
                            // ssml_elem.remark
                        ),
                        h("span", {
                            className: "iconfont icon-roundclosefill",
                            on: {
                                click: function () {
                                    console.log("handleDeleteNode");
                                    handleDeleteNode(editor, ssml_elem);
                                },
                            },
                        }),
                    ]
                ),
                // h("span", {
                //     className: "iconfont icon-tingdun",
                //     style: { color: "#27ae60" },
                // }),
            ]
        );
    },
};
